{% extends "base.html" %}
{% block ref %}
<link rel="stylesheet" charset="utf-8" href="/admin/style/setting-blog.css">

<script type="text/javascript" charset="utf-8" src="/editor/editor_config.js"></script>
<script type="text/javascript" charset="utf-8" src="/editor/editor_all.js"></script>
<script type="text/javascript" charset="utf-8" src="/admin/script/jquery-1.7.2.min.js"></script>
<script type="text/javascript" charset="utf-8" src="/admin/script/jquery.uploadify.min.js"></script>
<script type="text/javascript" charset="utf-8" src="/admin/script/timezone.js"></script>
<script>
function submit()
{
    document.forms[0].submit();
}
function cancel()
{
    window.location = "http://{{ host }}/admin/";
}
function checkChanged()
{
    var s = "";
    var inputs = $("input[type='checkbox'][id^='category']");
    for(var i=0; i<inputs.length; i++){
        if(inputs[i].checked){
            s += inputs[i].attributes["value"].value + ","
        }
    }
    var categories = $("#categories")[0];
    categories.value = s;
}
function append(n, tag, value, attr)
{
    var e = document.createElement(tag);
    e.innerText = value;
    var s;
    for(s in attr){
        e.setAttribute(s, attr[s]);
    }
    n.appendChild(e);
}
function onTimezoneOffsetChanged()
{
    var n = $('#blog-default-timezone-offset')[0];
    var offset = n.value;

    n = $('#blog-default-timezone')[0];
    n.innerHTML = '';
    var tzs = timezones[offset];
    for(var i in tzs)
    {
        append(n, 'option', tzs[i], {});
    }
}
</script>
{% endblock %}

{% block content %}
<div id="content">
<div id="main">
<div class="blog-profile">
<div class="head">
    <h1>博客设置</h1>
</div>
<div class="con">
<form action="" method="post" id="profile-form">
<ul class="list clearfix">
<li class="clearfix li">
    <div class="item-title">博客主题：</div>
    <div class="item">
        <select name="blog-theme">
            {% for t in themes %}
            <option {% ifequal t theme %}selected="selected"{% endifequal %} value="{{ t }}">
                {{ t }}
            </option>
            {% endfor %}
        </select>
    </div>
</li>
<li class="clearfix li">
    <div class="item-title">博客标题：</div>
    <div class="item">
        <input type="text" name="blog-title" class="ui-text skin-text-willwhite" value="{{ title }}" style="width: 244px; ">
        <div class="info errmsg" style="display: none">
            <span></span>
        </div>
    </div>
</li>
<li class="clearfix li">
    <div class="item-title">博客副标题：</div>
    <div class="item">
        <input type="text" name="blog-subtitle" class="ui-text skin-text-willwhite" value="{{ subtitle }}" style="width: 244px; ">
        <div class="info errmsg" style="display: none">
            <span></span>
        </div>
    </div>
</li>
<li class="clearfix li normal">
    <div class="item-title">博客介绍：</div>
    <div class="item">
        <textarea name="blog-description" class="ui-textarea skin-textarea-willwhite" style="height: 92px; overflow-x: auto; overflow-y: auto; width: 420px; ">{{ description }}</textarea>
    </div>
</li>
<li class="clearfix li normal">
    <div class="item-title">缺省时区：</div>
    <div class="item">
        <select id="blog-default-timezone-offset" name="blog-default-timezone-offset">
        </select>
        <select id="blog-default-timezone" name="blog-default-timezone">
        </select>
    </div>
    <script type="text/javascript">
        var cur_timezone = '{{ defaultTimezone }}';
        var cur_offset = '{{ defaultTimezoneOffset }}';

        var select_offset = $("#blog-default-timezone-offset")[0];
        for(var s in offsets){
            append(select_offset, 'option', offsets[s], offsets[s] == cur_offset ? {"selected": "selected"}: {});
        }

        var select_timezone = $('#blog-default-timezone')[0];
        var tzs = timezones[cur_offset];
        for(var s in tzs){
            append(select_timezone, 'option', tzs[s], tzs[s] == cur_timezone ? {"selected": "selected"}: {});
        }

        select_offset.onchange = onTimezoneOffsetChanged;
    </script>
</li>
<li class="clearfix li">
    <div class="item-title">每页文章数：</div>
    <div class="item">
        <input type="text" name="blog-articles-per-page" class="ui-text skin-text-willwhite" value="{{ articlesPerPage }}" style="width: 244px; ">
        <div class="info errmsg" style="display: none">
            <span></span>
        </div>
    </div>
</li>
<li class="clearfix li normal">
    <div class="item-title">自定义RSS：</div>
    <div class="item">
        <input name="blog-customRss" class="ui-text skin-text-willwhite" style="width: 420px; " value="{{ customRss }}" />
        <span>如果不为空，这个URL将取代缺省RSS(http://{{ host }}/rss/)</span>
    </div>
</li>
</ul>
</form>
<div class="clearfix panel">
    <div class="clearfix submit-ct">
        <div id="profile-submit">
            <div onclick="submit()" cloud="" id="ctrlbuttonprofile-submit" class="ui-button skin-button-willblue" style="width: 80px; ">
                <span class="ui-button-bg-left skin-button-willblue-bg-left"></span>
                <div id="ctrlbuttonprofile-submitlabel" class="ui-button-label skin-button-willblue-label">
                    <span id="ctrlbuttonprofile-submittext" class="ui-button-text skin-button-willblue-text">保存</span>
                </div>
            </div>
        </div>
    </div>
</div>
</div>
</div>
</div>
{% include 'region-sidebar.html' %}
</div>
{% endblock %}